package com.qianfeng.websocket;

import com.qianfeng.Event.DeviceCommandEvent;
import com.qianfeng.Event.DeviceStatusEvent;
import com.sun.org.apache.bcel.internal.generic.ALOAD;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/*
 *@Description:
 *@author:刘哥
 *@Date:86180 2022/9/13 20:08
 */
@Component
public class PowerCommandWebSocket extends BaseWebSocket {

    @EventListener
    public void onCommandEvent(DeviceCommandEvent event) throws IOException {
        sendMessage(event.getDeviceId(), event.getCommand());
    }
    @Override
    public boolean isNeedUpdateStatus() {
        return false;
    }
}
